
// 柯里化
function curry (fns) {
  return function curryied (...args) {
    if(fns.length > args.length) {
      return function () {
        return curryied(...args.concat([...arguments]))
      }
    }
    return fns.apply(fns, args)
  }
}
let cc = curry(function(a, b, c) {
  return a + b + c
})
console.log(cc(1)(2)(3))
console.log(cc(1,2)(3))
console.log(cc(1,2,3))
console.log(cc(1)(2,3))